package com.hyq.prototype.demo2;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: DeepCopyMail
 * @Description: 深拷贝邮件实例对象
 * @author Janus
 */
public class DeepCopyMail implements Cloneable {
	// 定义一个私有变量
	private ArrayList<String> arrayList = new ArrayList<String>();

	@Override
	public DeepCopyMail clone() {
		DeepCopyMail mail = null;
		try {
			mail = (DeepCopyMail) super.clone();
			mail.arrayList = (ArrayList<String>) this.arrayList.clone();
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return mail;
	}
	//设置集合值
	public void setListValule(String name){
		this.arrayList.add(name);
	}
	//获取值
	public List<String> getListValue(){
		return this.arrayList;
	}
}
